package dn.easy.common.utils;

import android.graphics.Color;
import android.os.CountDownTimer;
import android.widget.TextView;

/**
 * Class name 60秒--定时
 * Created by  2017/10/27 0027 10:46.
 * Author by yangjing
 */
public class TimeCount extends CountDownTimer {

    private TextView textView;

    public TimeCount(long millisInFuture, long countDownInterval, TextView view) {
        super(millisInFuture, countDownInterval);
        this.textView = view;
    }

    @Override
    public void onTick(long millisUntilFinished) {
        textView.setBackgroundColor(Color.parseColor("#B6B6D8"));
        textView.setClickable(false);
        textView.setText(+millisUntilFinished / 1000 + "秒后重发");
    }

    @Override
    public void onFinish() {
        textView.setText("重新获取");
        textView.setClickable(true);
        textView.setBackgroundColor(Color.parseColor("#4EB84A"));
    }
}

